Cosmetic cleanups.
authorMatthias Clasen <mclasen@redhat.com>
Mon, 12 Jun 2006 04:39:55 +0000 (04:39 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 12 Jun 2006 04:39:55 +0000 (04:39 +0000)
2006-06-12  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkprintjob.c:
* gtk/gtkprintbackend.c:
* gtk/gtkpagesetupunixdialog.c:
* gtk/gtkprintunixdialog.c: Cosmetic cleanups.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkpagesetupunixdialog.c
gtk/gtkprintbackend.c
gtk/gtkprintjob.c
gtk/gtkprintunixdialog.c

index 7aaab0fe033c157276c03fa50585ea30338d4db6..1beb172fbe5ca436ef21cdf540eb04b1ef4b7311 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-06-12  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkprintjob.c:
+       * gtk/gtkprintbackend.c: 
+       * gtk/gtkpagesetupunixdialog.c: 
+       * gtk/gtkprintunixdialog.c: Cosmetic cleanups.
+
 2006-06-11  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkassistant.c: Add an accessible implementation in
index 7aaab0fe033c157276c03fa50585ea30338d4db6..1beb172fbe5ca436ef21cdf540eb04b1ef4b7311 100644 (file)
@@ -1,3 +1,10 @@
+2006-06-12  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkprintjob.c:
+       * gtk/gtkprintbackend.c: 
+       * gtk/gtkpagesetupunixdialog.c: 
+       * gtk/gtkprintunixdialog.c: Cosmetic cleanups.
+
 2006-06-11  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkassistant.c: Add an accessible implementation in
index 6697effce7ba93fc3ca7b62c7ee49c5b60d0001b..3e7e49e30a267cfae707ebed99fd618b44523651 100644 (file)
@@ -602,7 +602,8 @@ get_current_page_setup (GtkPageSetupUnixDialog *dialog)
 }
 
 static gboolean
-page_setup_is_equal (GtkPageSetup *a, GtkPageSetup *b)
+page_setup_is_equal (GtkPageSetup *a, 
+                    GtkPageSetup *b)
 {
   return
     gtk_paper_size_is_equal (gtk_page_setup_get_paper_size (a),
@@ -614,7 +615,8 @@ page_setup_is_equal (GtkPageSetup *a, GtkPageSetup *b)
 }
 
 static gboolean
-page_setup_is_same_size (GtkPageSetup *a, GtkPageSetup *b)
+page_setup_is_same_size (GtkPageSetup *a,
+                        GtkPageSetup *b)
 {
   return gtk_paper_size_is_equal (gtk_page_setup_get_paper_size (a),
                                  gtk_page_setup_get_paper_size (b));
@@ -796,7 +798,8 @@ printer_changed_callback (GtkComboBox            *combo_box,
   GtkTreeIter iter;
 
   /* If we're waiting for a specific printer but the user changed
-     to another printer, cancel that wait. */
+   * to another printer, cancel that wait. 
+   */
   if (priv->waiting_for_printer)
     {
       g_free (priv->waiting_for_printer);
index aa6c38cad5458f3e0f1a501cf75004485903a75f..cbcf21e8fba836f7af5ce18a9331d1314626d98b 100644 (file)
@@ -193,11 +193,11 @@ _gtk_print_backend_module_create (GtkPrintBackendModule *pb_module)
 }
 
 static GtkPrintBackend *
-_gtk_print_backend_create (const char *backend_name)
+_gtk_print_backend_create (const gchar *backend_name)
 {
   GSList *l;
-  char *module_path;
-  char *full_name;
+  gchar *module_path;
+  gchar *full_name;
   GtkPrintBackendModule *pb_module;
   GtkPrintBackend *pb;
 
@@ -229,8 +229,9 @@ _gtk_print_backend_create (const char *backend_name)
          pb = _gtk_print_backend_module_create (pb_module);
 
          /* Increase use-count so that we don't unload print backends.
-            There is a problem with module unloading in the cups module,
-            see cups_dispatch_watch_finalize for details. */
+          * There is a problem with module unloading in the cups module,
+          * see cups_dispatch_watch_finalize for details. 
+          */
          g_type_module_use (G_TYPE_MODULE (pb_module));
        }
       
@@ -238,8 +239,6 @@ _gtk_print_backend_create (const char *backend_name)
     }
 
   return pb;
-
-  return NULL;
 }
 
 static void
@@ -267,7 +266,7 @@ gtk_print_backend_initialize (void)
 
 
 GList *
-gtk_print_backend_load_modules ()
+gtk_print_backend_load_modules (void)
 {
   GList *result;
   GtkPrintBackend *backend;
@@ -312,10 +311,10 @@ static void                 fallback_printer_request_details  (GtkPrinter
 static gboolean             fallback_printer_mark_conflicts   (GtkPrinter          *printer,
                                                               GtkPrinterOptionSet *options);
 static void                 fallback_printer_get_hard_margins (GtkPrinter          *printer,
-                                                              double              *top,
-                                                              double              *bottom,
-                                                              double              *left,
-                                                              double              *right);
+                                                              gdouble             *top,
+                                                              gdouble             *bottom,
+                                                              gdouble             *left,
+                                                              gdouble             *right);
 static GList *              fallback_printer_list_papers      (GtkPrinter          *printer);
 static GtkPrintCapabilities fallback_printer_get_capabilities (GtkPrinter          *printer);
   
@@ -401,7 +400,8 @@ gtk_print_backend_dispose (GObject *object)
   priv = backend->priv;
 
   /* We unref the printers in dispose, not in finalize so that
-     we can break refcount cycles with gtk_print_backend_destroy */
+   * we can break refcount cycles with gtk_print_backend_destroy 
+   */
   if (priv->printers)
     {
       g_hash_table_destroy (priv->printers);
@@ -418,7 +418,7 @@ fallback_printer_request_details (GtkPrinter *printer)
 }
 
 static gboolean
-fallback_printer_mark_conflicts (GtkPrinter *printer,
+fallback_printer_mark_conflicts (GtkPrinter          *printer,
                                 GtkPrinterOptionSet *options)
 {
   return FALSE;
@@ -426,10 +426,10 @@ fallback_printer_mark_conflicts (GtkPrinter *printer,
 
 static void
 fallback_printer_get_hard_margins (GtkPrinter *printer,
-                                  double *top,
-                                  double *bottom,
-                                  double *left,
-                                  double *right)
+                                  gdouble    *top,
+                                  gdouble    *bottom,
+                                  gdouble    *left,
+                                  gdouble    *right)
 {
   *top = 0;
   *bottom = 0;
@@ -451,9 +451,9 @@ fallback_printer_get_capabilities (GtkPrinter *printer)
 
 
 static void
-printer_hash_to_sorted_active_list (const gchar *key,
-                                    gpointer value,
-                                    GList **out_list)
+printer_hash_to_sorted_active_list (const gchar  *key,
+                                    gpointer      value,
+                                    GList       **out_list)
 {
   GtkPrinter *printer;
 
@@ -471,7 +471,7 @@ printer_hash_to_sorted_active_list (const gchar *key,
 
 void
 gtk_print_backend_add_printer (GtkPrintBackend *backend,
-                              GtkPrinter *printer)
+                              GtkPrinter      *printer)
 {
   GtkPrintBackendPrivate *priv;
   
@@ -489,7 +489,7 @@ gtk_print_backend_add_printer (GtkPrintBackend *backend,
 
 void
 gtk_print_backend_remove_printer (GtkPrintBackend *backend,
-                                 GtkPrinter *printer)
+                                 GtkPrinter      *printer)
 {
   GtkPrintBackendPrivate *priv;
   
@@ -537,7 +537,7 @@ gtk_print_backend_get_printer_list (GtkPrintBackend *backend)
       priv->printer_list_requested = TRUE;
     }
   
-  return result;;
+  return result;
 }
 
 gboolean
@@ -550,7 +550,7 @@ gtk_print_backend_printer_list_is_done (GtkPrintBackend *print_backend)
 
 GtkPrinter *
 gtk_print_backend_find_printer (GtkPrintBackend *backend,
-                                const gchar *printer_name)
+                                const gchar     *printer_name)
 {
   GtkPrintBackendPrivate *priv;
   GtkPrinter *printer;
@@ -568,12 +568,12 @@ gtk_print_backend_find_printer (GtkPrintBackend *backend,
 }
 
 void
-gtk_print_backend_print_stream (GtkPrintBackend *backend,
-                                GtkPrintJob *job,
-                                gint data_fd,
+gtk_print_backend_print_stream (GtkPrintBackend        *backend,
+                                GtkPrintJob            *job,
+                                gint                    data_fd,
                                 GtkPrintJobCompleteFunc callback,
-                                gpointer user_data,
-                               GDestroyNotify dnotify)
+                                gpointer                user_data,
+                               GDestroyNotify          dnotify)
 {
   g_return_if_fail (GTK_IS_PRINT_BACKEND (backend));
 
@@ -589,11 +589,11 @@ void
 gtk_print_backend_destroy (GtkPrintBackend *print_backend)
 {
   /* The lifecycle of print backends and printers are tied, such that
-     the backend owns the printers, but the printers also ref the backend.
-     This is so that if the app has a reference to a printer its backend
-     will be around. However, this results in a cycle, which we break
-     with this call, which causes the print backend to release its printers.
-  */
+   * the backend owns the printers, but the printers also ref the backend.
+   * This is so that if the app has a reference to a printer its backend
+   * will be around. However, this results in a cycle, which we break
+   * with this call, which causes the print backend to release its printers.
+   */
   g_object_run_dispose (G_OBJECT (print_backend));
 }
 
index 522256df34baa7c717ffc2ba7656292fcefabeba..534b78dbd93dd4126fb61a5152eb9f73f2978375 100644 (file)
@@ -47,7 +47,7 @@ struct _GtkPrintJobPrivate
 {
   gchar *title;
 
-  int spool_file_fd;
+  gint spool_file_fd;
   cairo_surface_t *surface;
 
   GtkPrintStatus status;
@@ -457,8 +457,8 @@ gtk_print_job_get_surface (GtkPrintJob  *job,
   g_return_val_if_fail (priv->spool_file_fd == -1, NULL);
  
   priv->spool_file_fd = g_file_open_tmp ("gtkprint_XXXXXX", 
-                                                   &filename, 
-                                                   error);
+                                        &filename, 
+                                        error);
   if (priv->spool_file_fd == -1)
     return NULL;
 
@@ -470,8 +470,8 @@ gtk_print_job_get_surface (GtkPrintJob  *job,
   height = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
   
   priv->surface = _gtk_printer_create_cairo_surface (priv->printer,
-                                                         width, height,
-                                                         priv->spool_file_fd);
+                                                    width, height,
+                                                    priv->spool_file_fd);
  
   return priv->surface;
 }
@@ -493,7 +493,7 @@ gtk_print_job_get_surface (GtkPrintJob  *job,
  */
 void
 gtk_print_job_set_track_print_status (GtkPrintJob *job,
-                                     gboolean track_status)
+                                     gboolean     track_status)
 {
   GtkPrintJobPrivate *priv;
 
@@ -501,7 +501,14 @@ gtk_print_job_set_track_print_status (GtkPrintJob *job,
 
   priv = job->priv;
 
-  priv->track_print_status = track_status;
+  track_status = track_status != FALSE;
+
+  if (priv->track_print_status != track_status)
+    {
+      priv->track_print_status = track_status;
+      
+      g_object_notify (job, "track-status");
+    }
 }
 
 /**
index 3f2e521050e99b91c597e2e5364f945ad6728302..b561df569f85825538f254782fe9bcf9ca66c040 100644 (file)
@@ -106,7 +106,7 @@ enum {
   PRINTER_LIST_N_COLS
 };
 
-#define _EXTENTION_POINT_MAIN_PAGE_CUSTOM_INPUT "gtk-main-page-custom-input"
+#define _EXTENSION_POINT_MAIN_PAGE_CUSTOM_INPUT "gtk-main-page-custom-input"
 
 struct GtkPrintUnixDialogPrivate
 {
@@ -164,15 +164,17 @@ struct GtkPrintUnixDialogPrivate
 
   GHashTable *extension_points;  
 
-  /* These are set initially on selected printer (either default printer, printer
-   * taken from set settings, or user-selected), but when any setting is changed
-   * by the user it is cleared */
+  /* These are set initially on selected printer (either default printer, 
+   * printer taken from set settings, or user-selected), but when any setting 
+   * is changed by the user it is cleared.
+   */
   GtkPrintSettings *initial_settings;
   
   /* This is the initial printer set by set_settings. We look for it in the
    * added printers. We clear this whenever the user manually changes
    * to another printer, when the user changes a setting or when we find
-   * this printer */
+   * this printer.
+   */
   char *waiting_for_printer;
   gboolean internal_printer_change;
   
@@ -184,7 +186,7 @@ struct GtkPrintUnixDialogPrivate
   gulong options_changed_handler;
   gulong mark_conflicts_id;
 
-  char *format_for_printer;
+  gchar *format_for_printer;
   
   gint current_page;
 };
@@ -193,7 +195,7 @@ G_DEFINE_TYPE (GtkPrintUnixDialog, gtk_print_unix_dialog, GTK_TYPE_DIALOG)
 
 static gboolean
 is_default_printer (GtkPrintUnixDialog *dialog,
-                   GtkPrinter *printer)
+                   GtkPrinter         *printer)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
 
@@ -679,7 +681,7 @@ wrap_in_frame (const gchar *label,
                GtkWidget   *child)
 {
   GtkWidget *frame, *alignment, *label_widget;
-  char *bold_text;
+  gchar *bold_text;
 
   label_widget = gtk_label_new ("");
   gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
@@ -763,7 +765,7 @@ add_option_to_table (GtkPrinterOption *option,
 {
   GtkTable *table;
   GtkWidget *label, *widget;
-  int row;
+  gint row;
 
   table = GTK_TABLE (user_data);
   
@@ -904,7 +906,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
   GList *groups, *l;
-  char *group;
+  gchar *group;
   GtkWidget *table, *frame;
   gboolean has_advanced, has_job;
  
@@ -1104,7 +1106,7 @@ schedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog)
     return;
 
   priv->mark_conflicts_id = g_idle_add (mark_conflicts_callback,
-                                               dialog);
+                                       dialog);
 }
 
 static void
@@ -1471,7 +1473,7 @@ create_main_page (GtkPrintUnixDialog *dialog)
   gtk_widget_show (custom_input);
   gtk_box_pack_start (GTK_BOX (vbox), custom_input, FALSE, FALSE, 0);
   g_hash_table_insert (priv->extension_points, 
-                       _EXTENTION_POINT_MAIN_PAGE_CUSTOM_INPUT,
+                       _EXTENSION_POINT_MAIN_PAGE_CUSTOM_INPUT,
                        custom_input);
 
   hbox = gtk_hbox_new (FALSE, 18);
@@ -1568,8 +1570,7 @@ create_main_page (GtkPrintUnixDialog *dialog)
   label = gtk_label_new (_("General"));
   gtk_widget_show (label);
   
-  gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
-                           main_vbox, label);
+  gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), main_vbox, label);
 }
 
 static gboolean
@@ -1583,11 +1584,11 @@ dialog_get_page_ranges (GtkPrintUnixDialog *dialog,
                        gint               *n_ranges_out)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
-  int i, n_ranges;
-  const char *text, *p;
-  char *next;
+  gint i, n_ranges;
+  const gchar *text, *p;
+  gchar *next;
   GtkPageRange *ranges;
-  int start, end;
+  gint start, end;
   
   text = gtk_entry_get_text (GTK_ENTRY (priv->page_range_entry));
 
@@ -1654,7 +1655,7 @@ dialog_set_page_ranges (GtkPrintUnixDialog *dialog,
                        gint                n_ranges)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
-  int i;
+  gint i;
   GString *s = g_string_new ("");
 
   for (i = 0; i < n_ranges; i++)
@@ -1667,8 +1668,7 @@ dialog_set_page_ranges (GtkPrintUnixDialog *dialog,
        g_string_append (s, ",");
     }
 
-  gtk_entry_set_text (GTK_ENTRY (priv->page_range_entry),
-                     s->str);
+  gtk_entry_set_text (GTK_ENTRY (priv->page_range_entry), s->str);
   
   g_string_free (s, TRUE);
 }
@@ -1688,7 +1688,8 @@ dialog_get_print_pages (GtkPrintUnixDialog *dialog)
 }
 
 static void
-dialog_set_print_pages (GtkPrintUnixDialog *dialog, GtkPrintPages pages)
+dialog_set_print_pages (GtkPrintUnixDialog *dialog, 
+                       GtkPrintPages       pages)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
 
@@ -1785,8 +1786,8 @@ static gint
 dialog_get_pages_per_sheet (GtkPrintUnixDialog *dialog)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
-  const char *val;
-  int num;
+  const gchar *val;
+  gint num;
 
   val = gtk_printer_option_widget_get_value (priv->pages_per_sheet);
 
@@ -1810,15 +1811,15 @@ draw_page_cb (GtkWidget          *widget,
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
   cairo_t *cr;
-  double ratio;
-  int w, h, tmp, shadow_offset;
-  int pages_x, pages_y, i, x, y, layout_w, layout_h;
-  double page_width, page_height;
+  gdouble ratio;
+  gint w, h, tmp, shadow_offset;
+  gint pages_x, pages_y, i, x, y, layout_w, layout_h;
+  gdouble page_width, page_height;
   GtkPageOrientation orientation;
   gboolean landscape;
   PangoLayout *layout;
   PangoFontDescription *font;
-  char *text;
+  gchar *text;
   GdkColor *color;
   
   orientation = gtk_page_setup_get_orientation (priv->page_setup);
@@ -2586,9 +2587,9 @@ gtk_print_unix_dialog_set_settings (GtkPrintUnixDialog *dialog,
                                    GtkPrintSettings   *settings)
 {
   GtkPrintUnixDialogPrivate *priv;
-  const char *printer;
+  const gchar *printer;
   GtkPageRange *ranges;
-  int num_ranges;
+  gint num_ranges;
   
   g_return_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog));
   g_return_if_fail (settings == NULL || GTK_IS_PRINT_SETTINGS (settings));
@@ -2652,7 +2653,7 @@ gtk_print_unix_dialog_get_settings (GtkPrintUnixDialog *dialog)
   GtkPrintSettings *settings;
   GtkPrintPages print_pages;
   GtkPageRange *ranges;
-  int n_ranges;
+  gint n_ranges;
 
   g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), NULL);
 
@@ -2706,8 +2707,8 @@ gtk_print_unix_dialog_get_settings (GtkPrintUnixDialog *dialog)
 
 void
 gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog *dialog,
-                                     GtkWidget *child,
-                                     GtkWidget *tab_label)
+                                     GtkWidget          *child,
+                                     GtkWidget          *tab_label)
 {
   gtk_notebook_insert_page (GTK_NOTEBOOK (dialog->priv->notebook),
                            child, tab_label, 2);